import re

def classify_email(email):
    if re.search(r"\.edu$|\.ac$", email):
        return "教育机构"
    elif re.search(r"\.com$|\.org$|\.net$", email):
        return "企业"
    elif re.search(r"\.gov$", email):
        return "政府机构"
    else:
        return "其他"

def validate_email(email):
    pattern = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
    if re.match(pattern, email):
        return True
    else:
        return False

def extract_email_parts(email):
    username, domain = email.split('@',1)
    domain_parts = domain.split('.')
    tld = domain_parts[-1]
    return {'username': username, 'domain': domain, 'tld': tld}

def obfuscate_email(email):
    dict1 = extract_email_parts(email)
    username = dict1['username']
    domain = dict1['domain']
    obfuscated_username = username[0] + '***' + username[-1]
    domain_parts = domain.split('.')
    obfuscated_domain = '**' + '.'.join(domain_parts[-2:])
    return obfuscated_username + '@' + obfuscated_domain

email = input("请输入你的邮箱地址: ")
if validate_email(email):
    print("邮箱地址有效！")
    print("邮箱分类:", classify_email(email))
    print("信息提取:", extract_email_parts(email))
    print("敏感信息隐藏:", obfuscate_email(email))
else:
    print("邮箱地址无效！")